#!/bin/bash
set -e

deploy() {
    echo "build $1..."
    rm -f $1.gz
    CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o ./$1 $2
    echo "copy.."
    gzip $1
    scp ./$1.gz $DIR1/
    rm -f $1.gz
    echo done!
}

deployhk() {
    echo "build $1..."
    rm -f $1.gz
    CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o ./$1 $2
    echo "copy.."
    gzip $1
    scp ./$1.gz $SSH2:~/outerworld
    rm -f $1.gz
    echo done!
}

# build one/many
for arg in "$@"
do
	if [[ $arg == 1 ]]; then
	    CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o bin/test8545_linux beeag/test/testeth
	elif [[ $arg == 2 ]]; then
	    echo 2
	else
		echo unknown argument: $arg
	fi
done
